package rocketman;
/*
Copyright (C) <year> <name of author>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
import java.awt.Graphics2D;
import java.util.*;

public class LevelStateLevel2 implements LevelState
{

private LinkedList<Enemy> enemies;
private LinkedList<Sprite> sprites;
private AIengine aiengine;
private int activationPixel = 0;//NOTE: doubled in class Game()
private Room room;
private LinkedList<Sprite> codecs;
private int spritecount = 3;
private double mapx = 0;
private boolean enemyflag0 = false;
private boolean enemyflag1 = false;
private boolean enemyflag2 = false;
public void setData(LinkedList<Enemy> e, LinkedList<Sprite> s, AIengine aie, Room r, LinkedList<Sprite> c, int spritecnt)
{
	enemies = e;
	sprites = s;
	aiengine = aie;
	room = r;
	codecs = c;
	spritecount = spritecnt;
	//NOTE instanceof rooms
	if (room == null || (room instanceof Room1) || (room instanceof Room3))
		room = new Room2(enemies,aiengine);

}

public void eventloop(Graphics2D g2d)
{
	activationPixel--;
      //EXAMPLE : if (mapx > 10 && activationPixel % 100 == 0) -> returning enemies each 100 frames when over x-mapx
      if (mapx > 10 && !enemyflag0) {
		//test aiengine.messageEngine("123");
		enemyflag0 = true;
//		room.addPart0(enemies,sprites,aiengine);
       }
      else if (mapx == 200 && !enemyflag1) {
		enemyflag1 = true;
//		room.addPart1(enemies,sprites,aiengine);
		room.addPart0(enemies,sprites,aiengine);
       }
      else if (mapx == 500 && !enemyflag2) {
		enemyflag2 = true;
		room.addPart1(enemies,sprites,aiengine);
       }
	
}

public void setMapX(double mx)
{
	mapx = mx;
}
};

